package com.badger.generator;

import static com.badger.generator.constant.DataBaseDriver.*;

import java.util.Arrays;

import com.badger.generator.constant.DataBaseDriver;
import com.badger.generator.entity.GeneratorAttr;
import com.badger.generator.pattern.AutoGeneratorTemplateFactory;

/**
 * 测试类
 * @author liqi
 *
 */
public class AppTestMysql {
	
	//生成 数据字典 ，运用前端 下拉框，字典值翻译    select  CONCAT("{name:'",param_code,"',value:'",param_name,"'},") from mk_re_calc_param
	//运用后端静态常量    select  CONCAT("(\"",param_code,"\",\"",param_name,"\")") from mk_re_calc_param
	
	
	
	
    public static void main(String[] args) {
        String url = "jdbc:mysql://10.92.226.18:3306/repttb";
        String user = "repttbus";
        String password = "tb@0807";
        GeneratorAttr attr = new GeneratorAttr();
        // 作者名字 ;
        attr.setAuthor("fpc");
        // 创建的类的包路径
        attr.setPackagePath("com.badger.generator");
        attr.setDriver(DataBaseDriver.MYSQL);
        attr.setUrl(url);
        attr.setUser(user);
        attr.setPassword(password);
        // 类名需要过滤的开头 eg：T,TB……，默认为null，不过滤表头.
        //attr.setIncludePrefix(Arrays.asList("gcc", "gcc_gpc_wares_info"));
        attr.setTables(Arrays.asList("gcc_trade_order_detail"));
        // 需要生成的表，默认为null，生成该数据库下，所有的表.
        String path = "D:\\springwind";
        AutoGeneratorTemplateFactory autoFactory = AutoGeneratorTemplateFactory.getInstance(attr);
        autoFactory.buildTkModel(BASE_ENTITY, true,false).buildMapper(BASE_MAPPER)
                .buildService(BASE_SERVICE, BASE_SERVICE_IMPL).buildController(API_CONTROLLER).write(path)
                .openFile(path);
    }
}
